const path = require('path');

module.exports = {
    chainWebpack: (config) => {
        config.resolve.alias
            .set('@', path.resolve(__dirname, './src'))
            .set('utils', path.resolve(__dirname, './src/utils'));

        // set svg-sprite-loader
        config.module
            .rule('svg')
            .exclude.add(path.resolve('src/icons'))
            .end();
        config.module
            .rule('icons')
            .test(/\.svg$/)
            .include.add(path.resolve('src/icons'))
            .end()
            .use('svg-sprite-loader')
            .loader('svg-sprite-loader')
            .options({
                symbolId: 'icon-[name]',
            })
            .end();
    },
};
